capture log close
log using replica_fig5_mc_test1.log,replace

*       RELICA_FIG5_5_MC_TEST1.LOG

*       FIRST VERSION   MARCH 12, 2007
*       THIS VERSION    AUGUST 10, 2012

*       LAST REVISOR    AI

*       INPUT FILE:             MC_SOGLIA2.RAW, MC_SOGLIA7.RAW
*       OUTPUT FILE:            FIGURA PER TEST MCRARY SU SORTING AROUND THRESHOLD
*
*	REPLICA FOR FIGURE 5

version 9.0

di "log file printed on $S_DATE at $S_TIME"


set more 1
clear
program drop _all
macro drop _all
scalar drop _all

# delimit ;

set scheme s1color;
set memory 300000; 
set matsize 250;
tempfile tmpf1 tmpf2 tmpf3 tmpf4;


* LEGGI I DATI;
infile mid_y emp_f smo_f using mc_soglia2.raw;
label var mid_y "Distance from nearest discontinuity in 1000 euros";
label var emp_f " ";
label var smo_f " ";
save mc_soglia2, replace;
clear;

infile mid_y emp_f smo_f using mc_soglia7.raw;
label var mid_y "Distance from nearest discontinuity in 1000 euros";
label var emp_f " ";
label var smo_f " ";
save mc_soglia7, replace;


* GRAFICO PER SOGLIA 2;
use mc_soglia2, clear;
twoway bar   emp_f  mid_y,  barw(.01) || line smo_f mid_y,
legend(off)
xline(0)  xlabel(-2(1)1.5)
l1("Empirical and smoothed frequencies")
title("Discontinuity 2" ) 
saving(mc_soglia2, replace)
;


* GRAFICO PER SOGLIA 7;
use mc_soglia7, clear;
twoway bar   emp_f  mid_y,  barw(.01) || line smo_f mid_y,
legend(off)
xline(0) xlabel(-3(1)5)
l1("Empirical and smoothed frequencies")
title("Discontinuity 7" ) 
saving(mc_soglia7, replace)
;


* figura a due pannelli per redditi intorno a soglia;
*gr combine mc_soglia2.gph mc_soglia7.gph ,  saving(mc_soglia, replace);
*graph export mc_soglia.eps, replace logo(off);

gr combine mc_soglia2.gph mc_soglia7.gph ,  saving(fig_5, replace);
graph export fig_5.eps, replace logo(off);


log close;
